<?php
/**
 * @fileoverview    我(她)喜欢的滚动接口
 * @author          xinhua
 * @date            Feb  02 11:31:49 CST 2012
 * @copyright       sina meila
 */

include_once '../../__global.php';
include_once './scroll_public.php';

class aj_scrollFavourite extends scroll_public{

    public function main(){
    
        $oUserfeed=new ml_model_dbUserfeed();
        $feed=$oUserfeed->getFeedByUid($this->_uid,$this->_begin,ML_FEED_PAGESIZE,ML_FEED_TYPE_ATTITUDE);
        
        
        //    数据结构不统一
        if(is_array($feed))
        foreach ($feed as $k => $v) {
                
            if(!empty($v['content_rid'])) {
                $feed[$k]['rid'] = $v['content_rid'];
                $rids[] = $v['content_rid'];
            }else{
                $feed[$k]['rid'] = $v['feed_info']['rid'];
                $rids[] = $v['feed_info']['rid'];
            }
            $feed[$k]["pin_type"] = 'verify_other';
        }
        $oContent = new ml_model_dbContent();
        $contents = $oContent->get_content_by_rids($rids);
        
        
        $likeModle=new ml_model_dbILike(); 
        $this->total=$likeModle->getCountByUid($this->_uid,3);
        
         
       
        $pin_biz=new ml_biz_pin_indexData();            
        $ifme=$this->_uid ==$this->__visitor['uid']?true:false;
        $pin_biz->set_ifme($ifme);
        $pin_biz->set_is_favourite(true);
        $data=$pin_biz->output($this->__visitor['uid'], $feed,$contents);
        
        
        $last=count($data)<ML_FEED_PAGESIZE?true:false;
        $finnal['lastSegment']=$last;
        $finnal['items']=$data;
        
        $this->api_output(ML_RCODE_SUCC,$finnal);

    }
}
new aj_scrollFavourite();
?>